package com.example.serverdemo.common;

public enum ErrorCode {
    CrcCheckFiled("CRC校验失败",1001);

    private  String Msg;
    private  int Code;
    private ErrorCode(String msg, int code) {
        this.Msg = msg;
        this.Code = code;
    }

    public  String getMsg(){
        return this.Msg;
    }

    public  int getCode(){
        return this.Code;
    }

    public void setMsg(String msg){
        this.Msg = msg;
    }

    public void setCode(int code){
        this.Code = code;
    }

    public static String getMsg(int code){
        for (ErrorCode errorCode : ErrorCode.values()){
            if (errorCode.getCode() == code){
                return errorCode.getMsg();
            }
        }
        return null;
    }
}
